package com.cll.mybatisPlus.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.cll.mybatisPlus.model.dto.PageInfo;
import com.cll.mybatisPlus.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenliangliang123
 * @since 2018-01-27
 */
@Controller
@RequestMapping("/user")
public class UserController {

    private IUserService userService;

    @Autowired
    protected UserController(IUserService userService){
        this.userService=userService;
    }


    @ResponseBody
    @GetMapping("/list/{page}")
    public Object listUser(@PathVariable("page") Integer page){
        return new PageInfo<>(userService.list(new Page<>(page,5),0));
    }

}

